﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" 
    xmlns:local="clr-namespace:ItemPicker;assembly=ItemPickerControl"    
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    >

    <Style TargetType="local:ItemPickerControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ItemPickerControl">
                    <Canvas>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0:0:0.2" To="Opened"/>
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Thumbnailed"/>
                                <vsm:VisualState x:Name="Opened">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="picker" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Border x:Name="thumbnail" Width="90" Height="90">
                            <TextBlock Text="Picker" />
                        </Border>

                        <StackPanel x:Name="picker" Visibility="Collapsed" Background="#66000000">
                            <ListBox x:Name="PART_PredefinedItems">

                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Border>
                                            <TextBlock Text="{Binding}"/>
                                        </Border>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>

                                <sys:String>images/img0.jpg</sys:String>
                                <sys:String>images/img1.jpg</sys:String>
                                <sys:String>images/img2.jpg</sys:String>
                                <sys:String>images/img3.jpg</sys:String>
                            </ListBox>
                        </StackPanel>
                    </Canvas>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>